package com.wjx.reservation_service.service.impl;

import com.wjx.reservation_service.dao.AppointmentDao;
import com.wjx.reservation_service.model.Appointment;
import com.wjx.reservation_service.service.IAppointmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IAppointmentServiceImpl implements IAppointmentService {
    @Autowired
    private AppointmentDao appointmentDao;
    public int addAppointment(Appointment appointment){
        return appointmentDao.addAppointment(appointment);
    }
    public List<Appointment> queryAppointmentByUserId(int userId){
        return appointmentDao.queryAppointmentByUserId(userId);
    }
    public List<Appointment> queryAllAppointment(){
        return appointmentDao.queryAllAppointment();
    }
    public Appointment queryAppointmentById(int id){
        return appointmentDao.queryAppointmentById(id);
    }
    public int updateAppointmentById(Appointment appointment){
        return appointmentDao.updateAppointmentById(appointment);
    }
    //根据id删除预约
    public int deleteAppointmentById(int id){
        return appointmentDao.deleteAppointmentById(id);
    }
    //根据关键词模糊查询
    public List<Appointment> queryLikeAppointment(String keyword){
        return appointmentDao.queryLikeAppointment(keyword);
    }
    //根据服务id查询预约
    public List<Appointment> queryAppointmentByServiceId(int serviceId){
        return appointmentDao.queryAppointmentByServiceId(serviceId);
    }
    //根据服务id删除预约
    public int deleteAppointmentByServiceId(int serviceId) {
        return appointmentDao.deleteAppointmentByServiceId(serviceId);
    }
    //根据用户id删除预约
    public int deleteAppointmentByUserId(int userId){
        return appointmentDao.deleteAppointmentByUserId(userId);
    }

}
